package com.itheima_01.monitest.first;

public class test2 {
    public static void main(String[] args) {
        int[] arr = {3, 5, 2, 6, 1};
        boolean b = existMethod(arr);
        if (b) {
            System.out.println("数组中存在2！");
        }
    }
    private static boolean existMethod(int[] arr) {
        boolean b = false;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == 2) {
                b = true;
            }
        }
        return b;
    }
}
